
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;

using Swaf;

namespace Swaf.BizRule
{
	/// <summary>
	/// The primary interface to execute business rules.
	/// </summary>
	public interface IRuleManager : IRuleExecutor
	{		
		/// <summary>Add a rule monitor to listen for rule execution events as the <code>RuleManager</code>
		/// executes rules and specific events occur during execution.</summary>
		/// <param name="monitor"></param>
		void addMonitor(IRuleMonitor monitor);
		
		/// <summary> Removes the rule monitor from listening to rule execution events.</summary>
		/// <param name="monitor"></param>
		void removeMonitor(IRuleMonitor monitor);
		
		/// <summary> Stops rule processing and shutsdown its <code>IRuleQueue</code> object, which means that
		/// no more rules will be executed via calls to <code>execute</code>.</summary>
		/// <remarks>
		/// This method should only be called when the application using the <code>RuleManager</code>
		/// is shutting down.</remarks>
		void stop(IApplication app);

		uint WorkerCount {get;set;}
	}

	/// <summary>
	/// Provides advances access to rule manager functionality, not normally used by the typically
	/// bizrule client code.
	/// </summary>
	public interface IRuleManagerEx
	{
		/// <summary>
		/// If code is called by a rule, this will return info about the rule, otherwise this will return
		/// null which indicates the current thread is not executing a rule at the time.
		/// </summary>
		IRunningRule CurrentThreadRunningRule{get;}
		IRuleInfo getRuleInfo(string name);
	}
}